<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<meta http-equiv="X-UA-Compatible" content="ie=edge" />
		<link rel="stylesheet" href="https://unpkg.com/codemirror@5.40.0/lib/codemirror.css" />
		<link rel="stylesheet" href="https://unpkg.com/codemirror@5.40.0/theme/material.css" />
		<title>Document</title>
		<style>
			html,
			body {
				margin: 0;
				padding: 0;
				width: 100%;
				height: 100%;
				overflow: hidden;
			}
			textarea {
				width: 100%;
				height: 100%;
			}
		</style>
	</head>
	<body>
		<textarea id="text">
			var myTextArea = document.getElementById('text');
			var editor = CodeMirror.fromTextArea(myTextArea, {
			  lineNumbers: true,
			  mode: 'javascript',
			  theme: 'material'
			});
			editor.on('change', () => {
			  console.log(editor.getValue());
			});
  </textarea
		>
	</body>
	<script src="https://unpkg.com/codemirror@5.40.0/lib/codemirror.js"></script>
	<script src="https://unpkg.com/codemirror@5.40.0/mode/javascript/javascript.js"></script>
	<script>
		var myTextArea = document.getElementById('text')
		var editor = CodeMirror.fromTextArea(myTextArea, {
			lineNumbers: true,
			mode: 'javascript',
			theme: 'material',
		})
		editor.on('change', () => {
			console.log(editor.getValue())
		})
	</script>
</html>
